package com.wink_172.library.view

import android.content.Context
import android.util.AttributeSet
import android.widget.ImageView
import android.widget.RelativeLayout
import android.widget.TextView
import com.wink_172.library.R

 open class EmptyView : RelativeLayout {
    open lateinit var icon_center: ImageView
    open  lateinit var content_view: TextView

    constructor(context: Context?) : super(context) {}
    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {}
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
    }

    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
    }

    override fun onFinishInflate() {
        super.onFinishInflate()
        initView()
    }

    private fun initView() {
        icon_center = findViewById(R.id.icon_center)
        content_view = findViewById(R.id.content)
    }

    open  fun updateContent(res: Int, content: String?) {
        icon_center!!.setImageResource(res)
        content_view!!.text = content
    }
}